/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.business;

import br.com.dao.DaoFactory;
import br.com.dao.ItemDao;
import br.com.dao.util.GenericDao;
import br.com.model.Item;
import br.com.util.ConnectionFactory;
import java.sql.SQLException;
import java.util.LinkedList;

/**
 *
 * @author Hercules Sandim
 */
public class ItemBO {

    public void insereItem(Item item)
    {
        GenericDao<Item> itemDao= DaoFactory.getDaoFactory().getItemDao();
        itemDao.save(item);
    }
      public LinkedList<Item> listarItemDisponivel() throws SQLException {
       ItemDao iDao = new ItemDao(ConnectionFactory.getConnection());
       return iDao.listarDisponivel();
    }

    public void updateReservado(Item it) throws SQLException {
        ItemDao item = new ItemDao(ConnectionFactory.getConnection());
        item.updateReservado(it);
    }

      public LinkedList<Item> getItemDoFilme(Integer idFilme) throws SQLException {
       ItemDao iDao = new ItemDao(ConnectionFactory.getConnection());
       return iDao.getItemDoFilme(idFilme);
    } 
      
    public Item getObjectByNumeroSerie(String numeroSerie)throws SQLException {
       ItemDao iDao = new ItemDao(ConnectionFactory.getConnection());
       return iDao.getObjectByNumeroSerie(numeroSerie);
    }
}
